package confInfo;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Attribute;
import java.util.List;
import java.util.Iterator;
import org.dom4j.io.XMLWriter;
import java.io.*;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader; 
import org.dom4j.DocumentHelper;

public class XmlReader {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		 try{
			   SAXReader saxReader = new SAXReader();
			   Document document = saxReader.read("E:/workplace/jsp_workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/xml/configure.xml");
			   for(int level=1;level<4;level++){
				   List l = document.selectNodes("//level"+level+"/*");
				   Iterator iter=l.iterator();
				   while(iter.hasNext()){
					   Element e = (Element)iter.next();
					   System.out.println("add item:"+ "level"+level + " " + e.getName()+" " + e.getText());
				   }
				   
			   }
		 }catch(Exception e){
           e.printStackTrace();
       }

	}

}
